using System;
using Gtk;

namespace Jandaya.Framework.Dialogs
{
	/// <summary>
	/// Facade para Gtk.MessageDialog
	/// </summary>
	public static class MsgDialog
	{
		private static ResponseType result;
		
		public static ResponseType Show(string pMessage){			
			Gtk.MessageDialog dlg = new Gtk.MessageDialog(null,
			                                      DialogFlags.Modal,
			                                      MessageType.Info,
			                                      ButtonsType.Ok,
			                                      pMessage);
			result = (ResponseType)dlg.Run();
			dlg.Destroy();
			return result;
		}
		
		/// <summary>
		/// Show a dialog of MessageType.Question type with a YesNo button type
		/// </summary>
		/// <param name="pMessage">
		/// A <see cref="System.String"/>
		/// </param>
		/// <returns>
		/// A <see cref="ResponseType"/>
		/// </returns>
		public static ResponseType ShowQuestion(string pMessage){
			Gtk.MessageDialog dlg = new Gtk.MessageDialog(null,
			                                      DialogFlags.Modal,
			                                      MessageType.Question,
			                                      ButtonsType.YesNo,
			                                      pMessage);
			result = (ResponseType)dlg.Run();
			dlg.Destroy();
			return result;			
		}
		
		public static ResponseType ShowError(string pMessage){
			Gtk.MessageDialog dlg = new Gtk.MessageDialog(null,
			                                      DialogFlags.Modal,
			                                      MessageType.Error,
			                                      ButtonsType.Ok,
			                                      pMessage);
			result = (ResponseType)dlg.Run();
			dlg.Destroy();
			return result;			
		}
		
		public static ResponseType ShowWarning(string pMessage){
			Gtk.MessageDialog dlg = new Gtk.MessageDialog(null,
			                                      DialogFlags.Modal,
			                                      MessageType.Warning,
			                                      ButtonsType.Ok,
			                                      pMessage);
			result = (ResponseType)dlg.Run();
			dlg.Destroy();
			return result;			
		}
	}
}

